//
//  YDNoticeManCell.swift
//  YDOAProduct
//
//  Created by YDWY on 2017/5/27.
//  Copyright © 2017年 Allen. All rights reserved.
//

import UIKit

class YDNoticeManCell: UITableViewCell {

    @IBOutlet weak var titleLab: UILabel!
    @IBOutlet weak var contentLab: UILabel!
    
   
    //闭包回调
    var callBackWithId :((_ ID : Int) -> Swift.Void)? = nil
    var model : YDOAAnnouncementModel!{
        didSet{
            if model != nil{
                titleLab.text = model.title
                if model.content!.characters.count > 100 {
                    guard let index = model.content?.index((model.content?.startIndex)!, offsetBy: 100) else{return };
                    contentLab.text = model.content?.substring(to: index)
                }else{
                    contentLab.text = model.content
                }
                
               
            }
        }
    }
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        self.contentView.backgroundColor = UIColor.clear
        self.backgroundColor = UIColor.clear
        
        
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    
    
    //查看详情
    @IBAction func toDetial(_ sender: Any) {
        //查看详情
        if callBackWithId != nil {
            callBackWithId!(model.id!)
        }
    }
}
